# -*_ codeing=utf-8 -*-
# @Time: 2025/10/27 20:14
# @Author: foxhuty
# @File: delete_data.py
# @Software: PyCharm
# @Based on python 3.10
from sqlalchemy import delete
from sqlalchemy.orm import sessionmaker
from sqlalchemy_notes.db_main import engine
from sqlalchemy_notes.student_manager.models import Student

with sessionmaker(bind=engine).begin() as session:
    # # 第一种
    # emp=session.get(Student, 6)
    # session.delete(emp)
    # 第二种，性能更优
    stmt=delete(Student).where(Student.id == 3)
    session.execute(stmt)
